<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
		//fetch 发送待查询字符串格式的get请求 
		fetch('http://localhost:3000/books?id=2',{
			method:'get'
		}).then((data)=>{
			return data.text()
		}).then((data)=>{
			console.log(data) 
		})
		
		//fetch 发送：restFul接口规范
		fetch('http://localhost:3000/books/3',{
			method:'get'
		}).then((data)=>{
			return data.text()
		}).then((data)=>{
			console.log(data) 
		})
		
		//delete请求
		//restFull接口规范只和请求方式有关，和请求地址无关
		fetch('http://localhost:3000/books/3',{
			method:'delete'
		}).then((data)=>{
			return data.text()
		}).then((data)=>{
			console.log(data)
		})
    </script>	
</body>

</html>